home *** CD-ROM | disk | FTP | other *** search
- Path: engnews1.Eng.Sun.COM!taumet!clamage
- From: "Nathan Myers, http://www.cantrip.org/" <ncm@cantrip.org>
- Newsgroups: comp.std.c++
- Subject: Re: template and const
- Date: 29 Mar 1996 16:09:53 GMT
- Organization: The Cantrip Cooperative
- Approved: clamage@eng.sun.com (comp.std.c++)
- Message-ID: <315B306B.5271C407@cantrip.org>
- References: <AD8043589668101EA@sleipner.nts.mh.se>
- NNTP-Posting-Host: taumet.eng.sun.com
- Mime-Version: 1.0
- Content-Type: text/plain; charset="us-ascii"
- Content-Transfer-Encoding: 7bit
- X-Nntp-Posting-Host: ncm.vip.best.com
- X-Mailer: Mozilla 2.01 (X11; I; Linux 1.2.13 i386)
- X-Lines: 25
- Content-Length: 843
- Originator: clamage@taumet
-
- Lars Farm <lars.farm@nts.mh.se> wrote:
- >
- > Is "pair<T1,T2>" valid as function argument where the
- > declaration expects "const pair<const T1,T2>&"?
-
- [It would allow: ]
- > void f( string a, string b )
- > {
- > map<string,string> m;
- > ...
- > m.insert( make_pair(a,b) ); // valid c++? [yes, now.]
-
- The definition of the template pair<> was changed at the March '96
- meeting specifically to allow this.
-
- pair<> now has a template constructor. Of course that is of little
- use to you (for now) if you (like most of us) don't yet have a compiler
- that supports member templates. In the meantime you might like to
- write a little template function, make_map_pair<>().
-
- If we had type deduction from constructor arguments, even make_pair<>()
- would be unnecessary. Next time, next time.
-
- Nathan Myers
- ncm@cantrip.org http://www.cantrip.org/
-
-
- [ comp.std.c++ is moderated. To submit articles: try just posting with ]
- [ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
- [ FAQ: http://reality.sgi.com/employees/austern_mti/std-c++/faq.html ]
- [ Policy: http://reality.sgi.com/employees/austern_mti/std-c++/policy.html ]
- [ Comments? mailto:std-c++-request@ncar.ucar.edu ]
-